//
//  NSObject+AutoCancaelCategary.swift
//  SwiftNetwork
//
//  Created by 万孟超 on 2022/1/12.
//

import Foundation

private var networkAutoCancelKey : Void?

extension NSObject {
    var networkAutoCancel : NetworkAutoCancelModel {
        get {
            var tempProperty = objc_getAssociatedObject(self, &networkAutoCancelKey) as? NetworkAutoCancelModel
            if tempProperty == nil {
                print("初始化属性")
                tempProperty = NetworkAutoCancelModel.init()
                objc_setAssociatedObject(self, &networkAutoCancelKey, tempProperty, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
            }
            return tempProperty!
        }
    }
    
}
